<!DOCTYPE html>
<html>
<?php $this->load->view('admin/public/header.html');?>
<style>
    . space{padding:20px;}

</style>
<body class="childrenBody">

<form class="layui-form layui-row layui-col-space20" lay-filter="expert_form">
    <div class="layui-col-md6 layui-col-xs12 ">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">评论ID</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="commentId" value="<?php echo @$info['commentId']?> " lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">订单编号</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="trade_no" value="<?php echo @$info['trade_no']?>" lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">用户姓名</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="realName" value="<?php echo @$info['realName']?>" lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">用户昵称</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="nickName" value="<?php echo @$info['nickName']?>" lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">用户头像</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <img class="layui-upload-img thumbImg avatarimg" name="avatar" src="">
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">评价分数</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="judge" value="<?php echo @$info['judge']?>" lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">评价内容</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <textarea placeholder="" name="content" lay-verify="required" class="layui-textarea brief" disabled><?php echo $info['content'];?></textarea>
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">评价图片</label>
                    <?php foreach($info['images'] as $key=>$val):?>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <img class="layui-upload-img thumbImg avatarimg" name="avatar" src="<?php echo @$val['url']?>" disabled>
                    </div>
                    <?php endforeach;?>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">点赞数量</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="zanNum" value="<?php echo @$info['zanNum']?>" lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">回复数量</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="replyNum" value="<?php echo @$info['replyNum']?>" lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">评价时间</label>
                    <div class="layui-input-block" style="margin-left: 130px;">
                        <input type="text" class="layui-input name" name="createTime" value="<?php echo @$info['createTime']?>" lay-verify="require" disabled >
                    </div>
                </div>

                <div class="layui-form-item magt3">
                    <label class="layui-form-label" style="width: 90px;">回复</label>
                    <?php if(!empty($info['repaly'])) {?>
                    <?php foreach($info['repaly'] as $key=>$val):?>
                    <div class="layui-form-item magt3">
                        <label class="layui-form-label" style="width: 90px; color: #b21e1e"><?php echo ($key+1);?>用户姓名</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <input type="text" class="layui-input name" name="realName" value="<?php echo @$val['realName']?>" lay-verify="require" disabled >
                        </div>
                    </div>

                    <div class="layui-form-item magt3">
                        <label class="layui-form-label" style="width: 90px;">用户昵称</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <input type="text" class="layui-input name" name="nickName" value="<?php echo @$val['nickName']?>" lay-verify="require" disabled >
                        </div>
                    </div>

                    <div class="layui-form-item magt3">
                        <label class="layui-form-label" style="width: 90px;">回复内容</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <textarea placeholder="" name="content" lay-verify="required" class="layui-textarea brief" disabled><?php echo $info['content'];?></textarea>
                        </div>
                    </div>

                    <?php if(!empty($val['images'])){?>
                    <div class="layui-form-item magt3">
                        <label class="layui-form-label" style="width: 90px;">回复图片</label>
                        <?php foreach($val['images'] as $key=>$val):?>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <img class="layui-upload-img thumbImg avatarimg" name="avatar" src="<?php echo @$val['url']?>" disabled>
                        </div>
                        <?php endforeach;?>
                    </div>
                    <?php }?>

                    <div class="layui-form-item magt3">
                        <label class="layui-form-label" style="width: 90px;">回复时间</label>
                        <div class="layui-input-block" style="margin-left: 130px;">
                            <input type="text" class="layui-input name" name="createTime" value="<?php echo @$val['createTime']?>" lay-verify="require" disabled >
                        </div>
                    </div>
                    <?php endforeach;?>
                    <?php }?>
                </div>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript">
   /* var path='/zhuojian/public/appeditor/';
    layui.config({
        base : path
    }).extend({
        "appeditor" : "appeditor"
    })*/
    layui.use(['form','layer','layedit','laydate','upload','laytpl'],function(){
        var el={
            // "el" : '#appeditor',
            "name" :  'intro',
            'data' : "[{'text' : 1},{'text' : 3},{'image' : 'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=643873983,4278247275&fm=58'},{'text' : 2}]"
        };

        // layui.appeditor._init_(el);

        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            laypage = layui.laypage,
            upload = layui.upload,
            laytpl = layui.laytpl,
            layedit = layui.layedit,
            laydate = layui.laydate,
            $ = layui.jquery;


        //用于同步编辑器内容到textarea
        layedit.sync(editIndex);

        //上传缩略图
        upload.render({
            elem: '.thumbBox',
            url: '../../json/userface.json',
            method : "get",  //此处是为了演示之用，实际使用中请将此删除，默认用post方式提交
            done: function(res, index, upload){
                var num = parseInt(4*Math.random());  //生成0-4的随机数，随机显示一个头像信息
                $('.thumbImg').attr('src',res.data[num].src);
                $('.thumbBox').css("background","#fff");
            }
        });

        //格式化时间
        function filterTime(val){
            if(val < 10){
                return "0" + val;
            }else{
                return val;
            }
        }


        form.on("submit(addNews)",function(data){

            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});

            $.ajax({
                type:'post',
                data:data.field,
                url:'action',
                dataType: "json",
                success:function(res){
                    //console.log(res.code);return;
                    if(res.code==200){
                        top.layer.close(index);
                        top.layer.msg("添加成功！");
                        layer.closeAll("iframe");
                        //刷新父页面
                        parent.location.reload();
                    }else{
                        top.layer.close(index);
                        top.layer.msg("添加失败！");
                    }
                },
                fail:function(){
                    top.layer.close(index);
                    top.layer.msg("添加失败！");
                }
            })

        })


        form.on("submit(bannerSubmit)",function(data){

            var index=layer.load();
            $.ajax({
                type:'post',
                data:data.field,
                url:'<?php echo site_url("seller/comment/repaly")?>',
                dataType: "json",
                success:function(res){
                    //console.log(res.code);return;
                    if(res.code==200){
                        top.layer.close(index);
                        top.layer.msg("操作成功！");
                        //刷新父页面
                        //parent.location.reload();
                        location.href=history.back();
                    }else{
                        top.layer.close(index);
                        top.layer.msg("操作失败！");
                    }
                },
                fail:function(){
                    top.layer.close(index);
                    top.layer.msg("操作失败！");
                }
            })
            return false;
        })
        //创建一个编辑器
        var editIndex = layedit.build('content',{
            height : 535,
            uploadImage : {
                url : "../../json/newsImg.json"
            }
        });

    })
</script>
</body>
</html>